import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
          colorScheme: const ColorScheme(
              primary: Colors.black,
              surfaceVariant: Colors.white,
              secondary: Colors.green,
              background: Colors.white, //整个页面背景色
              error: Colors.red,
              brightness: Brightness.light,
              onBackground: Colors.white,
              outlineVariant: Colors.white,
              onError: Colors.yellow,
              onPrimary: Colors.white,
              onSecondary: Colors.white,
              onSurface: Color.fromARGB(255, 233, 233, 240),
              surface: Colors.blue) //整个标题栏颜色
          // primarySwatch: Colors.blue, // 设置主色调,无效，怎么设都是白色
          ),
      home: Scaffold(
        appBar: AppBar(title: const Text("P27"), centerTitle: true),
        body: const HomePage(),
      ),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return ListView(
      children: [
        Container(
          width: double.infinity,
          height: 200,
          color: Colors.redAccent,
        ),
        Row(
          children: [
            Expanded(
                flex: 2,
                child: SizedBox(
                    height: 180,
                    child: Image.network(
                        "https://www.itying.com/images/flutter/2.png",
                        fit: BoxFit.fill))),
            Expanded(
                flex: 1,
                child: Container(
                    height: 180,
                    color: Colors.green,
                    child: Column(
                      //垂直排列，可以指定宽度
                      children: [
                        Expanded(
                            flex: 1,
                            child: SizedBox(
                                width: double.infinity, //让子控件占满父容器
                                child: Image.network(
                                  "https://www.itying.com/images/flutter/3.png",
                                  fit: BoxFit.fill,
                                ))),
                        const SizedBox(
                          height: 5,
                        ),
                        Expanded(
                            flex: 2,
                            child: SizedBox(
                                width: double.infinity,
                                child: Image.network(
                                    "https://www.itying.com/images/flutter/4.png",
                                    fit: BoxFit.fill))),
                      ],
                    )))
          ],
        )
      ],
    );
  }
}
